/*
 * *******************************************************************
 *   @项目名称: BHex Android
 *   @文件名称: FragmentAdapter.java
 *   @Date: 19-1-8 下午8:16
 *   @Author: ppzhao
 *   @Description:
 *   @Copyright（C）: 2019 BlueHelix Inc.   All rights reserved.
 *   注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的.
 *  *******************************************************************
 */

package io.bhex.app.market.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Pair;

import java.util.List;

public class FragmentAdapter extends FragmentPagerAdapter {
    private final List<Pair<String, Fragment>> mItems;

    public FragmentAdapter(FragmentManager fm,List<Pair<String, Fragment>> items) {
        super(fm);
        mItems = items;
    }

    @Override
    public Fragment getItem(int position) {
        return mItems.get(position).second;
    }

    @Override
    public int getCount() {
        return mItems.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mItems.get(position).first;
    }
}
